import Vue from 'vue'
import Element from 'element-ui'
import App from '@/App'
import i18n from '@/i18n'
import router from '@/router'
import store from '@/store'
import '@/icons'
import '@/element-ui/theme/index.css'
import '@/assets/scss/aui.scss'
import http from '@/utils/request'
// import { hasPermission, getDictLabel, getDictList, getDateStr } from '@/utils'
import cloneDeep from 'lodash/cloneDeep'
import componentsPro from '@/components/index.js'
import $cookies from '@/utils/cookies.js'
import userBehavior from '@/utils/userBehavior.js'
import * as $utils from '@/utils'
import * as $cfg from '@/config'
// 全局 api 定义
import * as $apis from '@/config/apis'
import './plugins/xeutils'
import './plugins/quill'
import './plugins/vue-element-extends'
import './plugins/vxetable'
import './plugins/form-making'

Vue.config.productionTip = false
Vue.use(Element, {
  size: 'mini',
  i18n: (key, value) => i18n.t(key, value)
})
Vue.use(componentsPro)
// 挂载全局
Vue.prototype.$http = http
Vue.prototype.$utils = $utils
Vue.prototype.$hasPermission = $utils.hasPermission
Vue.prototype.$getDictLabel = $utils.getDictLabel
Vue.prototype.$getDictList = $utils.getDictList
Vue.prototype.$getDictTreeList = $utils.getDictTreeList
Vue.prototype.$getDateStr = $utils.getDateStr
Vue.prototype.$getDataItem = $utils.getDataItem
Vue.prototype.$formatDate = $utils.formatDate
Vue.prototype.$cookies = $cookies
Vue.prototype.$userBehavior = userBehavior
Vue.prototype.$cfg = $cfg
Vue.prototype.$apis = $apis

// 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount('#app')
